//
//  LotGDActionPickerViewController.m
//  LotGD
//
//  Created by Thiago on 20/07/2009.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "ActionPickerViewController.h"


@implementation ActionPickerViewController
@synthesize actionPicker, pickerData, pickerLinks, rootView;

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
 if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
 // Custom initialization
 }
 return self;
 }
 */

- (id) initWithView:(UIView *)view;
{
	if ([self init]) {
		self.rootView = view;
		//this is the label on the tab button itself
		self.title = @"Action";
	}
	return self;
}



// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
	
	UIView *mview = [[UIView alloc] initWithFrame: CGRectMake(0.0, 240.0, 100.0, 100.0)];
	
	actionPicker = [[UIPickerView alloc] initWithFrame: CGRectMake(0.0, 240.0, 100.0, 100.0)];
	actionPicker.showsSelectionIndicator = YES;
	NSArray *actionArray = [[NSArray alloc] initWithObjects:@"Forest", @"Slay Other Players", @"Quit To The Fields", @"Mercenary Camp", nil];
	NSArray *urlArray = [[NSArray alloc] initWithObjects:@"http://www.shackbbs.com", @"http://www.google.com", @"http://www.facebook.com", @"http://www.shacknews.com", nil];
 	self.pickerData = actionArray;
	actionPicker.delegate = self;
	actionPicker.dataSource = self;
	actionPicker.autoresizingMask = UIViewAutoresizingFlexibleWidth;
	
	self.view = mview;
	[self.view addSubview:actionPicker];
	//self.view = rootView;
	
    [actionArray release];
	[urlArray release];
	
}


/*
 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
 - (void)viewDidLoad {
 [super viewDidLoad];
 }
 */

/*
 // Override to allow orientations other than the default portrait orientation.
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 // Return YES for supported orientations
 return (interfaceOrientation == UIInterfaceOrientationPortrait);
 }
 */

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}

#pragma mark -
#pragma mark Picker Data Source Methods
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
	return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView
numberOfRowsInComponent:(NSInteger)component {
	
	return [pickerData count];	
}

#pragma mark Picker Delegate Methods
- (NSString *)pickerView:(UIPickerView *)pickerView
			 titleForRow:(NSInteger)row
			forComponent:(NSInteger)component {
	return [pickerData objectAtIndex:row];
}

-(void)pickerView:(UIPickerView *)pickerView 
	 didSelectRow:(NSInteger)row 
	  inComponent:(NSInteger)component{
}



- (void)dealloc {
    [super dealloc];
}


@end
